<h1>Listing profiles</h1> 

<% if @profiles.length > 0 %>
  <% for profile in @profiles %>
    <p><%= link_to profile.name, profile %></p>
  <% end %>
<% else %>
  <p>No profiles.</p>
<% end %>
<% if @user %>
  <% if @user.profile.nil? %>
    <%= link_to 'New profile', new_profile_path %>
  <% end %>
<% else %>
 <%= link_to 'Log in to create your profile now!', :controller => "user", :action => "login" %>
<% end %>